package chapter;

public class object_recursion {
    public static void main(String[] args) {
    int result = computeAP(10);
    System.out.println(result);
    }
    public static int computeAP(int num) {
        num = num % 2 == 0 ? num -1 : num;

        if ( num == 1) {
            return 1;
        }
        else {
            return num + computeAP(num -2);
            //TODO 自己调用自己为递归调用，但是必须有跳出的逻辑，且传递的参数有规律
        }
    }
}
